Embeddings
Embeddings are numerical representations of text that are commonly used for semantic search, vector retrieval, and Retrieval-Augmented Generation (RAG). BindAI provides an embedding abstraction that separates embedding generation from the retrieval and Knowledge layers. The current implementation includes:EmbeddingProviderRandomEmbeddingProviderOpenAIEmbeddingProvider
What Is an Embedding?
An embedding converts content such as text into a numerical vector. Conceptually:EmbeddingProvider
BindAI defines anEmbeddingProvider abstraction for embedding generation.
The abstraction allows embedding consumers to work with different implementations without depending directly on one embedding service.
Conceptually:
RandomEmbeddingProvider
BindAI includesRandomEmbeddingProvider as a deterministic local embedding implementation.
It is useful for:
- Development
- Testing
- Local experiments
- Retrieval tests
- Environments where a hosted embedding API is not required
OpenAIEmbeddingProvider
BindAI providesOpenAIEmbeddingProvider for OpenAI embeddings.
The default model is:
Embedding Dimensions
Embedding dimensions determine the length of the generated vector. For example, an embedding configured with:Why Embeddings Are Useful
Traditional keyword search primarily looks for matching words. For example:Semantic Search
A typical embedding-based search architecture is:Document Embeddings
Knowledge documents are commonly split into chunks before embedding.Query Embeddings
At query time, the user’s question can also be converted into a vector.Vector Search
Vector search compares a query vector against stored document vectors. Conceptually:- Cosine similarity
- Dot product
- Euclidean distance
Embeddings and Retrieval
Embeddings are one component of a larger retrieval architecture. BindAI currently provides:- Embedding abstractions
- Vector retrieval
- BM25 retrieval
- Hybrid retrieval
- Retrieval configuration
- Search options
- Reranking
Hybrid Retrieval
Embeddings can be combined with lexical retrieval. For example:- Exact terminology matching
- Semantic similarity
Embeddings and Reranking
Embedding-based retrieval often produces an initial set of candidates. A reranker can then improve the ordering.Embeddings and Knowledge
Embeddings are an important part of the Knowledge architecture. A simplified Knowledge ingestion flow is:Embeddings and Memory
Embeddings and Memory should remain conceptually distinct. BindAI’s Memory subsystem supports vector-oriented memory throughVectorMemoryProvider.
A MemoryRecord can also contain an optional embedding.
For example:
embedding field stores vector data on the memory record.
This does not mean that every memory provider automatically generates embeddings.
Embedding generation remains the responsibility of the configured embedding implementation or application.
VectorMemoryProvider
VectorMemoryProvider provides vector-oriented memory behavior.
This allows Memory and embeddings to work together when an application needs similarity-based memory retrieval.
The architecture can be viewed as:
Embeddings and Vector Storage
Embedding generation and vector storage are separate responsibilities. For example:OpenAI Embeddings Configuration
The OpenAI embedding provider can be configured with a model and dimension. Example:Embedding Provider Selection
The appropriate embedding provider depends on the application’s requirements.
When selecting an embedding provider, consider:
- Retrieval quality
- Supported languages
- Vector dimensions
- Latency
- Cost
- Privacy requirements
- Deployment environment
- Compatibility with vector storage
Embedding Model Consistency
The same compatible embedding model should normally be used for document indexing and query embedding. For example:Changing Embedding Models
Changing the embedding model may require reprocessing existing knowledge. For example:Embedding Quality
Embedding quality affects semantic retrieval quality. Important factors include:- Model selection
- Input text quality
- Chunking strategy
- Language support
- Vector dimensions
- Similarity configuration
- Retrieval strategy
- Reranking
Embeddings and Document Chunking
Chunking and embeddings are closely related. Consider:Embeddings and Metadata
Vectors should normally remain associated with useful source metadata. For example:Embeddings in a RAG Pipeline
A complete embedding-based RAG architecture can look like:Embeddings Are Not Tools
An embedding provider and a BindAI tool serve different purposes. An embedding provider transforms information:Embeddings and Agents
Embeddings normally operate below the agent’s conversational interface. A simplified architecture is:Embedding Errors
Embedding operations can fail for several reasons, including:- Invalid API credentials
- Provider connectivity problems
- Unsupported models
- Invalid dimensions
- Rate limits
- Service errors
- Incompatible vector storage
Security and Privacy
Embeddings can represent information derived from sensitive documents. Applications should consider:- What data is sent to hosted embedding providers
- Whether sensitive content can leave the deployment environment
- Storage security
- Tenant isolation
- Access controls
- Data retention
- Credential management
Best Practices
- Use the same compatible embedding model for indexing and querying.
- Keep vector dimensions consistent with vector storage.
- Choose chunk sizes appropriate to the source documents.
- Preserve useful metadata with embedded content.
- Re-embed documents when the embedding model changes.
- Rebuild indexes when dimensions or incompatible embedding models change.
- Use local/deterministic embeddings for development and testing where appropriate.
- Use hosted embedding providers according to their API and privacy requirements.
- Keep embedding generation separate from agent business logic.
- Combine vector retrieval with BM25 when hybrid search is beneficial.
- Use reranking when additional relevance refinement is needed.
- Test retrieval with representative documents and questions.
- Do not hard-code API credentials.
- Treat embedding data as potentially sensitive application data.
Current Project Status
BindAI currently provides a concrete embedding layer. Implemented components include:EmbeddingProviderRandomEmbeddingProviderOpenAIEmbeddingProvider- Configurable OpenAI embedding model
- Configurable OpenAI embedding dimensions
- Embedding integration with vector-oriented retrieval
- Embedding support within the broader Knowledge architecture
- Document processing
- Chunking
- Vector retrieval
- BM25 retrieval
- Hybrid retrieval
- Metadata filtering
- Reranking
- Conversational retrieval
- Knowledge pipelines
- Agent Knowledge integration
